<template>
	<view>
		<TopNavCustom title="项目大事记"></TopNavCustom>
		<view class="container">

			<view v-for="(node,index) in noteList " :key="index">
				<view class="card" v-if="noteList.length != 0">
					<advanced-label :content="node.partName"></advanced-label>
					<view v-for="(item,i) in node._data" :key="i">
						<u-cell size="mini" :title="item.partName" isLink @click="goto(item)"></u-cell>
					</view>
					<!-- <u-cell size="mini" title="各单体楼栋主体结构封顶" @click="goto('item')" isLink></u-cell> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	//考虑是否和房屋节点一起处理，还是单独处理
	import _public from '@/common/public.js'
	import _project from '@/common/project.js'
	import _constant from "@/common/constant.js"
	export default {
		onLoad(para) {
			console.log(para)
			this._url = '/pages/ihome/project_memorabilia_upload/project_memorabilia_upload'
		},
		created() {
			this._getNoteList()
		},
		data() {
			return {
				noteList: [1, 2, 3],
				_url: ''
			};
		},
		methods: {
			async _getNoteList() {
				let id = await _constant.getConstentPartId('项目大事记')
				console.log(id)
				let result = await _public.getByParent(id)
				for (let i = 0; i < result.length; i++) {
					let child = await _public.getByParent(result[i].partId)
					result[i]._data = child
				}
				this.noteList = result ? result : []
			},
			goto(node) {
				let _node = node
				_node.estateId = uni.getStorageSync("estateId")
				// _node.projectId = uni.getStorageSync("ProjectId")
				_node.upload = false
				_node.type = true
				let item = encodeURIComponent(JSON.stringify(_node))
				uni.navigateTo({
					url: this._url + '?item=' + item
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 20rpx 30rpx;

		.card {
			padding: 20rpx 30rpx;
			border: 1rpx solid #efefef;
			border-radius: 20rpx;
			background-color: #FFFFFF;
			margin-bottom: 20rpx;
		}
	}
</style>
